package br.com.hs.biosys.model.persistence.generics;

import br.gov.frameworkdemoiselle.stereotype.PersistenceController;
import br.gov.frameworkdemoiselle.transaction.Transactional;
import java.io.Serializable;
import java.util.List;

/**
 * GenericReadWriteDAO.class
 *
 * @author Ranlive Hrysyk
 * @since 18/07/2012
 */
@PersistenceController
public interface GenericReadWriteDAO<T, I> extends Serializable {

    /**
     * Inserir bean.
     *
     * @param bean the bean
     */
    @Transactional
    void insert(T bean);

    /**
     * Atualizar bean no banco.
     *
     * @param bean the bean
     */
    @Transactional
    void update(T bean);

    /**
     * Deletar bean do banco.
     *
     * @param id the id
     */
    @Transactional
    void delete(final I id);

    /**
     * Listar todos os registros.
     *
     * @return the list of beans
     */
    List<T> findAll();

    /**
     * Carregar bean pelo id.
     *
     * @param id the id
     * @return the bean
     */
    T load(final I id);
}
